fn main() {
    // 闭包，与函数类似，但包含作用域上下文信息
    // 双竖线 存放 闭包参数
    let doubler = |x| x * 2;
    let value = 5;
    let twice = doubler(value);
    println!("{} doubled is {}", value, twice);

    // 闭包作为表达式赋值，以分号结尾
    let big_closure = |b, c| {
        let z = b + c;
        z * twice
    };
    let some_number = big_closure(1, 2);
    println!("Result from closure: {}", some_number);
}